<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<div id="app">
  {{msg}}===={{total}}
  <hr>
  <input type="text" v-model="total">

  </input>




</div>
<script src="https://cdn.bootcdn.net/ajax/libs/vue/2.7.14/vue.min.js"></script>
<script>
  const vu = new Vue({
    el: "#app",
    data: {
      msg: 'hello vue',
      str: '123'


    },
    methods: {

    },
    computed: {
      total: {
        // 进入就执行get,要有返回值
        get () {
          return this.str
        },

        //修改,获得新值
        set (newValue) {
          this.str = newValue
        }
      }

    }
  })
</script>






</body>

</html>